﻿using UnityEngine;

public class Boader : MonoBehaviour
{
    private Character player;
    private Rect rect;
    [SerializeField]
    private Vector2 size;

    private void Start()
    {
        player = Character.Instance;
        rect = new Rect(transform.position.RemoveZ() - 0.5f * size, size);
    }

    private void FixedUpdate()
    {
        if (!rect.Contains(player.transform.position))
        {
            player.Die();
        }
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireCube(transform.position, size.AddZ());
    }
}
